package com.jiang.daily.Q2829;

/**
 * @author Jiang
 * @version 1.0
 * @date 2025/03/26 13:31
 */
public class Solution {
    public int minimumSum(int n, int k) {
        int res = 0;

        int p = k / 2;
        for (int i = 1; n > 0 && i <= p; i++, n--) {
            res += i;
        }

        for (int i = k; n > 0; i++, n--) {
            res += i;
        }
        return res;
    }
}
